#include "com.h"

int main()
{
  key_t key = ftok(PATHNAME, PROJ_ID); 
  if(key == -1){
    perror("ftok");
    return 1;
  }

  int shmid = shmget(key, SIZE, IPC_CREAT | IPC_EXCL | 0644); 
  if(shmid < 0){
    perror("shmget");
    return 1;
  }

  char* shmaddr = shmat(shmid, NULL, 0);
 
  while(1){
    sleep(1);
    printf("client# %s\n", shmaddr);
  }

  shmdt(shmaddr);
  
  shmctl(shmid, IPC_RMID, NULL);
  return 0;
}
